#!/bin/sh

set -eu

jiapkg_build() {
	ncurses_DIR=$($JIAPKG_EXE info --install-dir ncurses)

	export CFLAGS="-I$ncurses_DIR/include"
	export LDFLAGS="-L$ncurses_DIR/lib"

	./configure --prefix="$JIAPKG_INSTALL_DIR" \
		--with-tlib=tinfo

	make -j"$JIAPKG_JOBS"
}

jiapkg_install() {
	make install
}

case "$1" in
build) jiapkg_build ;;
install) jiapkg_install ;;
esac
